from django.urls import path
# 导入当前模块的views
from userweb.views import account as account_views
from userweb.views import login as login_views
from userweb.views import role as role_views
from userweb.views import menu as menu_views
from userweb.views import permission as permission_views

urlpatterns = [

    # =================== 登陆账号 /user/account/ ===============
    path('account/', account_views.index, name="account"), # 用户账号管理页面
    path('account/list/', account_views.list_values, name="list_account"), # 获取登陆账号的数据
    path('account/add/', account_views.add_value, name="add_account"), # 添加账号
    path('account/edit/', account_views.edit_value, name="edit_account"), # 编辑账号
    path('account/del/', account_views.del_value, name='del_account'), # 删除账号
    path('account/is_exists/', account_views.is_exists_account, name="is_exists_account"), # 判断账号是否存在
    path('account/chpwd/', account_views.change_pwd, name="chpwd_account"), # 修改密码
    path('account/chstatus/',account_views.change_login_status, name="ch_status_account"), # 修改账号的状态

    # ===================用户登陆 /user/login/ ==================
    path('login/', login_views.index, name="login"), # 用户登陆的页面
    path('login/handle/', login_views.login_handle, name="login_handle"),
    path('logout/handle/', login_views.logout_handle, name="logout_handle"),

    # ================ 角色 /user/role/ =================================
    path('role/', role_views.index, name="role"),
    path('role/list/', role_views.list_values, name="list_role"),
    path('role/add/', role_views.add_value, name="add_role"),
    path('role/edit/', role_views.edit_value, name="edit_role"),
    path('role/del/', role_views.del_value, name="del_role"),
    path('role/is_exists/name/', role_views.is_exists_role_name, name="role_exists_name"),
    path('role/get/all/', role_views.get_values, name="get_roles_all"),
    path('role/update/permission/', role_views.update_permission, name='role_update_permission'),

    # ================ 菜单管理 ============================
    path('menu/', menu_views.index, name="menu"),
    path('menu/list/', menu_views.list_values, name="list_menu"),
    path('menu/add/', menu_views.add_value, name="add_menu"),
    path('menu/edit/', menu_views.edit_value, name="edit_menu"),
    path('menu/del/', menu_views.del_value, name="del_menu"),

    # ================= 权限管理 ===========================
    path('permission/', permission_views.index, name="permission"),
    path('permission/list/', permission_views.list_values, name="list_permission"),
    path('permission/get/order/', permission_views.get_permission_by_order, name="permission_get_order"),
    path('permission/add/', permission_views.add_value, name="add_permission"),
    path('permission/edit/', permission_views.edit_value, name="edit_permission"),
    path('permission/del/', permission_views.del_value, name="del_permission"),
    path('permission/role/', permission_views.get_permission_by_role, name="role_permission"),

]